package com.chap16.immutability;

/**
 * <p>
 * <code>Demo</code>
 * </p>
 *
 * @author junbao3
 * TODO
 * @date 2023-04-25 15:32
 * Copyright (C) 2021 IFlyTek. All rights reserved.
 */
public class Demo {
    public static void main(String[] args) {
        SmsInfo smsInfo = new SmsInfo("https://www.aliyun.com",180);

        //修改短信服务商的信息
        new Thread(()->{
            smsInfo.setUrl("https://cloud.tencent.com");
            //模拟高并发
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            smsInfo.setMaxSizeInBytes(300);
        },"线程1").start();


        //读取短信服务商的信息
        new Thread(()->{
            System.out.println("获取短信服务商信息："+smsInfo);
        },"线程2").start();
    }
}

/*
线程2读取的时候，可能url和字节数对应不上
*/